using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Fated {
    public abstract class AbstractMap {
        protected Point cursor = Point.Zero;
        protected bool cursorVis = true;

        protected Point rangeCenter = Point.Zero;
        protected int rangeRadius = 0;
        protected bool rangeVis = false;

        public abstract string getTileset();
        public abstract int getTile(int x, int y);
        public abstract Rectangle getTileSize();
        public abstract bool containsCharacter(int x, int y);
        public abstract String getCharacter(int x, int y);
        public abstract int getTileHeight(int x, int y);
        public abstract int getHeight();
        public abstract int getWidth();

        public Point getCursor() {
            return cursor;
        }
        public void setCursor(Point newCursor) {
            cursor = newCursor;
        }
        public void moveCursorBy(int x, int y) {
            cursor.X += x;
            cursor.Y += y;
            if (cursor.X < 0) cursor.X = getWidth() - 1;
            if (cursor.X >= getWidth()) cursor.X = 0;
            if (cursor.Y < 0) cursor.Y = getHeight() - 1;
            if (cursor.Y >= getHeight()) cursor.Y = 0;
        }

        public Point getRangeCenter() {
            return rangeCenter;
        }
        public void setRangeCenter(Point newCenter) {
            rangeCenter = newCenter;
        }
        public int getRangeRadius() {
            return rangeRadius;
        }
        public void setRangeRadius(int newRadius) {
            rangeRadius = newRadius;
        }


        public int distance(int x1, int y1, int x2, int y2) {
            return (int)Math.Abs(x1 - x2) + (int)Math.Abs(y1 - y2);
        }
        public int distance(Point p) {
            return (int)Math.Abs(cursor.X - p.X) + 
                (int)Math.Abs(cursor.Y - p.Y);
        }

        public bool isCursorVisible(){
            return cursorVis;
        }
        public void isCursorVisible(bool visible){
            cursorVis = visible;
        }
        public bool isRangeVisible() {
            return rangeVis;
        }
        public void isRangeVisible(bool visible) {
            rangeVis = visible;
        }
    }
}
